

#import "CPopupMenu.h"


@implementation CPopupMenu

@synthesize isPopup;


- (id)initWithCoder:(NSCoder *)aDecoder
{
	if (self = [super initWithCoder:aDecoder])
	{
		popupRect = self.frame;
		hideRect = CGRectMake(popupRect.origin.x, popupRect.origin.y + 
							  popupRect.size.height, popupRect.size.width, 0);
		self.frame = hideRect;
		isPopup = NO;
		[self.layer setCornerRadius:10.0];
		[self setClipsToBounds:YES];
	}
	return self;
}


-(void)Popup
{
	isPopup = YES;
	[UIView beginAnimations:nil context:nil];
	[UIView setAnimationDuration:0.2];
	[UIView setAnimationCurve:UIViewAnimationCurveLinear];
	[self setFrame:popupRect];
	[UIView commitAnimations];
}


- (void)Hide
{
	isPopup = NO;
	[UIView beginAnimations:nil context:nil];
	[UIView setAnimationDuration:0.2];
	[UIView setAnimationCurve:UIViewAnimationCurveLinear];
	[self setFrame:hideRect];
	[UIView commitAnimations];
}


- (void)dealloc
{
    [super dealloc];
}


@end
